﻿/*
'    Stream Classes
'    Copyright 2008-2011 Daniel Wagner O. de Medeiros
'
'    This file is part of DTL.
'
'    DWSIM is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    DWSIM is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with DTL.  If not, see <http://www.gnu.org/licenses/>.

Imports DTL.DTL.ClassesBasicasTermodinamica
Imports CapeOpen = CAPEOPEN110
Imports DTL.DTL.SimulationObjects.PropertyPackages
Imports System.Runtime.InteropServices
Imports CAPEOPEN110
*/
using System;
using System.Collections.Generic;

namespace  PVTLibrary
{
    [Serializable]
    public class MaterialStream : SimulationObjects_BaseClass
        /*'CAPE-OPEN 1.0
        Implements ICapeIdentification, ICapeThermoMaterialObject, ICapeThermoCalculationRoutine, ICapeThermoEquilibriumServer, ICapeThermoPropertyPackage
        'CAPE-OPEN 1.1
        Implements ICapeThermoMaterial, ICapeThermoCompounds, ICapeThermoPhases, ICapeThermoUniversalConstant, ICapeThermoPropertyRoutine, ICapeThermoEquilibriumRoutine, ICapeThermoMaterialContext
        'CAPE-OPEN Error Interfaces
        Implements ECapeUser, ECapeUnknown, ECapeRoot*/
    {

        public enum CompBasis
        {
            Molar_Fractions,
            Mass_Fractions,
            Volumetric_Fractions,
            Molar_Flows,
            Mass_Flows,
            Volumetric_Flows,
        }

        public enum  Flashspec
        {
            Temperature_and_Pressure = 0,
            Pressure_and_Enthalpy ,
            Pressure_and_Entropy ,
            Pressure_and_VaporFraction ,
            Temperature_and_VaporFraction 
        }

        PropertyPackage _pp;
        string _ppid = "";

        protected CompBasis m_compositionbasis  = CompBasis.Molar_Fractions;
        protected Dictionary<string, Fase> m_Phases = new Dictionary<string, Fase> ();
        private bool _inequilibrium  = false;

#region "    DWSIM Specific"


        private Flashspec _flashspec = Flashspec.Temperature_and_Pressure;

        public Flashspec SpecType
        {
            get{
                return _flashspec;
            }
            set{
                _flashspec = value;
            }            
        }

        public bool AtEquilibrium
        {
            get{
                return _inequilibrium;
            }
            set{
                _inequilibrium = value;
            }            
        }

        public PropertyPackage PropertyPackage
        {
            get{
                return _pp;
            }
            set{
                if(value!=null)
                    _ppid = value.UniqueID;
            }            
        }

        public CompBasis CompositionBasis
        {
            get{
                return m_compositionbasis;
            }
            set{
                m_compositionbasis = value;
            }            
        }

         public Dictionary<string, Fase> Fases
        {
            get{
                return m_Phases;
            }
        }


        public void New(string nome , string descricao )
        {
            base.CreateNew();

            _componentName = nome;
            _componentDescription = descricao;

            Fases.Add("0", new  Fase("Mistura", ""));
            Fases.Add("1", new  Fase("OverallLiquid", ""));
            Fases.Add("2", new  Fase("Vapor", ""));
            Fases.Add("3", new  Fase("Liquid1", ""));
            Fases.Add("4", new  Fase("Liquid2", ""));
            Fases.Add("5", new  Fase("Liquid3", ""));
            Fases.Add("6", new  Fase("Aqueous", ""));
            Fases.Add("7", new  Fase("Solid", ""));
        }



        public void Assign(MaterialStream stream)
        {
            this.AtEquilibrium = stream.AtEquilibrium;

            //'Copy properties from the ASource stream.

            for(int i = 0 ; i< 8;i++)
            {
                var key =i.ToString();

                if(stream.Fases.ContainsKey(key))
                {

                    Fases[key].SPMProperties.temperature = stream.Fases[key].SPMProperties.temperature;
                    Fases[key].SPMProperties.pressure    = stream.Fases[key].SPMProperties.pressure;
                    Fases[key].SPMProperties.enthalpy    = stream.Fases[key].SPMProperties.enthalpy;

                    //'Copy component properties.                    

                    foreach(var comp in Fases[key].Componentes.Values)
                    {
                        comp.FracaoMolar = stream.Fases[key].Componentes[comp.Nome].FracaoMolar;
                        comp.FracaoMassica = stream.Fases[key].Componentes[comp.Nome].FracaoMassica;
                    }

                    //'Should be defined after concentrations?!?! [yes, no, maybe... whatever]
                    Fases[key].SPMProperties.massflow = stream.Fases[key].SPMProperties.massflow;
                    Fases[key].SPMProperties.molarflow = stream.Fases[key].SPMProperties.molarflow;

                    Fases[key].SPMProperties.massfraction = stream.Fases[key].SPMProperties.massfraction;
                    Fases[key].SPMProperties.molarfraction = stream.Fases[key].SPMProperties.molarfraction;
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="stream"></param>
        public void AssignProps(MaterialStream stream )
        {

            for(int i = 0 ; i< 8;i++)
            {
                var key =i.ToString();

                if(stream.Fases.ContainsKey(key))
                {
                    Fases[key].SPMProperties.temperature = stream.Fases[key].SPMProperties.temperature;
                    Fases[key].SPMProperties.pressure = stream.Fases[key].SPMProperties.pressure;
                    Fases[key].SPMProperties.density = stream.Fases[key].SPMProperties.density;
                    Fases[key].SPMProperties.enthalpy = stream.Fases[key].SPMProperties.enthalpy;
                    Fases[key].SPMProperties.entropy = stream.Fases[key].SPMProperties.entropy;
                    Fases[key].SPMProperties.molar_enthalpy = stream.Fases[key].SPMProperties.molar_enthalpy;
                    Fases[key].SPMProperties.molar_entropy = stream.Fases[key].SPMProperties.molar_entropy;
                    Fases[key].SPMProperties.compressibilityFactor = stream.Fases[key].SPMProperties.compressibilityFactor;
                    Fases[key].SPMProperties.heatCapacityCp = stream.Fases[key].SPMProperties.heatCapacityCp;
                    Fases[key].SPMProperties.heatCapacityCv = stream.Fases[key].SPMProperties.heatCapacityCv;
                    Fases[key].SPMProperties.molecularWeight = stream.Fases[key].SPMProperties.molecularWeight;
                    Fases[key].SPMProperties.thermalConductivity = stream.Fases[key].SPMProperties.thermalConductivity;
                    Fases[key].SPMProperties.speedOfSound = stream.Fases[key].SPMProperties.speedOfSound;
                    Fases[key].SPMProperties.volumetric_flow = stream.Fases[key].SPMProperties.volumetric_flow;
                    Fases[key].SPMProperties.jouleThomsonCoefficient = stream.Fases[key].SPMProperties.jouleThomsonCoefficient;
                    Fases[key].SPMProperties.excessEnthalpy = stream.Fases[key].SPMProperties.excessEnthalpy;
                    Fases[key].SPMProperties.excessEntropy = stream.Fases[key].SPMProperties.excessEntropy;
                    Fases[key].SPMProperties.compressibility = stream.Fases[key].SPMProperties.compressibility;
                    Fases[key].SPMProperties.bubbleTemperature = stream.Fases[key].SPMProperties.bubbleTemperature;
                    Fases[key].SPMProperties.bubblePressure = stream.Fases[key].SPMProperties.bubblePressure;
                    Fases[key].SPMProperties.dewTemperature = stream.Fases[key].SPMProperties.dewTemperature;
                    Fases[key].SPMProperties.dewPressure = stream.Fases[key].SPMProperties.dewPressure;
                    Fases[key].SPMProperties.viscosity = stream.Fases[key].SPMProperties.viscosity;
                    Fases[key].SPMProperties.kinematic_viscosity = stream.Fases[key].SPMProperties.kinematic_viscosity;
                    Fases[key].SPMProperties.molarflow = stream.Fases[key].SPMProperties.molarflow;
                    Fases[key].SPMProperties.massflow = stream.Fases[key].SPMProperties.massflow;
                    Fases[key].SPMProperties.massfraction = stream.Fases[key].SPMProperties.massfraction;
                    Fases[key].SPMProperties.molarfraction = stream.Fases[key].SPMProperties.molarfraction;     
                }
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public void Clear()
        {
            for(int i = 0 ; i< 8;i++)
            {
                var key =i.ToString();

                Fases[key].SPMProperties.temperature = null;
                Fases[key].SPMProperties.pressure = null;
                Fases[key].SPMProperties.enthalpy = null;
                Fases[key].SPMProperties.molarfraction = null;
                Fases[key].SPMProperties.massfraction = null;

                // Copy component properties.
                foreach(var comp in Fases[key].Componentes.Values)
                {
                    comp.FracaoMolar = null;
                    comp.FracaoMassica = null;
                }

                //'Should be define after concentrations?!?!
                Fases[key].SPMProperties.massflow = null;
                Fases[key].SPMProperties.molarflow = null;
            }
        }

        public void SetOverallComposition(List<double> Vx)
        {
            int i=0;

            foreach(var comp in Fases["0"].Componentes.Values)
            {
                comp.FracaoMolar = Vx[i];
                i += 1;
            }
        }

        public void SetPhaseComposition(List<double> Vx , Phase phase )
        {
            
            var i    = 0;
            var idx  = 0;

            switch(phase)
            {
                case Phase.Aqueous:
                    idx = 2;
                    break;

                case Phase.Liquid:
                    idx = 1;
                    break;

                case Phase.Liquid1:
                    idx = 3;
                    break;

                case Phase.Liquid2:
                    idx = 4;
                    break;

                case Phase.Liquid3:
                    idx = 5;
                    break;

                case Phase.Mixture:
                    idx = 0;
                    break;

                case Phase.Solid:
                    idx = 7;
                    break;

                case Phase.Vapor:
                    idx = 2;
                    break;

                default:
                    break;
            }

            foreach(var comp in Fases[idx.ToString()].Componentes.Values)
            {
                comp.FracaoMolar = Vx[i];
                i += 1;
            }
        }

        public override object GetPropertyValue(string prop , Unidades su = null) 
        {
            
            if(su ==null)
                su = new UnidadesSI();

            var cv = new Conversor();
            double value=0.0;
            string sname  = "";

            int propidx  = (int) prop.Split(",")[0].Split("_")[2];
            
            if(prop.Split(",").Length == 2)
            {
                sname = prop.Split(",")[1];
            }

            switch(propidx)
            {
                case 0:
                    //PROP_MS_0 Temperature
                    value = cv.ConverterDoSI(su.spmp_temperature, Fases["0"].SPMProperties.temperature.GetValueOrDefault);
                    break;
                case 1:
                    //PROP_MS_1 Pressure
                    value = cv.ConverterDoSI(su.spmp_pressure, Fases["0"].SPMProperties.pressure.GetValueOrDefault);
                    break;
                case 2:
                    //PROP_MS_2	Mass Flow
                    value = cv.ConverterDoSI(su.spmp_massflow, Fases["0"].SPMProperties.massflow.GetValueOrDefault);
                    break;
                case 3:
                    //PROP_MS_3	Molar Flow
                    value = cv.ConverterDoSI(su.spmp_molarflow, Fases["0"].SPMProperties.molarflow.GetValueOrDefault);
                    break;
                case 4:
                    //PROP_MS_4	Volumetric Flow
                    value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    break;
                case 5:
                    //PROP_MS_5	Mixture Density
                    value = cv.ConverterDoSI(su.spmp_density, Fases["0"].SPMProperties.density.GetValueOrDefault);
                    break;
                case 6:
                    //PROP_MS_6	Mixture Molar Weight
                    value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["0"].SPMProperties.molecularWeight.GetValueOrDefault);
                    break;
                case 7:
                    //PROP_MS_7	Mixture Specific Enthalpy
                    value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["0"].SPMProperties.enthalpy.GetValueOrDefault);
                    break;
                case 8:
                    //PROP_MS_8	Mixture Specific Entropy
                    value = cv.ConverterDoSI(su.spmp_entropy, Fases["0"].SPMProperties.entropy.GetValueOrDefault);
                    break;
                case 9:
                    //PROP_MS_9	Mixture Molar Enthalpy
                    value = cv.ConverterDoSI(su.molar_enthalpy, Fases["0"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    break;
                case 10:
                    //PROP_MS_10	Mixture Molar Entropy
                    value = cv.ConverterDoSI(su.molar_entropy, Fases["0"].SPMProperties.molar_entropy.GetValueOrDefault);
                    break;
                case 11:
                    //PROP_MS_11	Mixture Thermal Conductivity
                    value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["0"].SPMProperties.thermalConductivity.GetValueOrDefault);
                    break;
                case 12:
                    //PROP_MS_12	Vapor Phase Density
                    value = cv.ConverterDoSI(su.spmp_density, Fases["2"].SPMProperties.density.GetValueOrDefault);
                    break;
                case 13:
                    //PROP_MS_13	Vapor Phase Molar Weight
                    value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["2"].SPMProperties.molecularWeight.GetValueOrDefault);
                    break;
                case 14:
                    //PROP_MS_14	Vapor Phase Specific Enthalpy
                    value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["2"].SPMProperties.enthalpy.GetValueOrDefault);
                    break;
                case 15:
                    //PROP_MS_15	Vapor Phase Specific Entropy
                    value = cv.ConverterDoSI(su.spmp_entropy, Fases["2"].SPMProperties.entropy.GetValueOrDefault);
                    break;
                case 16:
                    //PROP_MS_16	Vapor Phase Molar Enthalpy
                    value = cv.ConverterDoSI(su.molar_enthalpy, Fases["2"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    break;
                case 17:
                    //PROP_MS_17	Vapor Phase Molar Entropy
                    value = cv.ConverterDoSI(su.molar_entropy, Fases["2"].SPMProperties.molar_entropy.GetValueOrDefault);
                    break;
                case 18:
                    //PROP_MS_18	Vapor Phase Thermal Conductivity
                    value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["2"].SPMProperties.thermalConductivity.GetValueOrDefault);
                    break;
                case 19:
                    //PROP_MS_19	Vapor Phase Kinematic Viscosity
                    value = cv.ConverterDoSI(su.spmp_cinematic_viscosity, Fases["2"].SPMProperties.kinematic_viscosity.GetValueOrDefault);
                    break;
                case 20:
                    //PROP_MS_20	Vapor Phase Dynamic Viscosity
                    value = cv.ConverterDoSI(su.spmp_viscosity, Fases["2"].SPMProperties.viscosity.GetValueOrDefault);
                    break;
                case 21:
                    //PROP_MS_21	Vapor Phase Heat Capacity (Cp)
                    value = cv.ConverterDoSI(su.spmp_heatCapacityCp, Fases["2"].SPMProperties.heatCapacityCp.GetValueOrDefault);
                    break;
                case 22:
                    //PROP_MS_22	Vapor Phase Heat Capacity Ratio (Cp/Cv)
                    value = Fases["2"].SPMProperties.heatCapacityCp.GetValueOrDefault / Fases["2"].SPMProperties.heatCapacityCv.GetValueOrDefault;
                    break;
                case 23:
                    //PROP_MS_23	Vapor Phase Mass Flow
                    value = cv.ConverterDoSI(su.spmp_massflow, Fases["2"].SPMProperties.massflow.GetValueOrDefault);
                    break;

                case 24:
                    //PROP_MS_24	Vapor Phase Molar Flow
                    value = cv.ConverterDoSI(su.spmp_molarflow, Fases["2"].SPMProperties.molarflow.GetValueOrDefault);
                    break;

                case 25:
                    //PROP_MS_25	Vapor Phase Volumetric Flow
                    value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["2"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    break;

                case 26:
                    //PROP_MS_26	Vapor Phase Compressibility Factor
                    value = Fases["2"].SPMProperties.compressibilityFactor.GetValueOrDefault;
                    break;

                case 27:
                    //PROP_MS_27	Vapor Phase Molar Fraction
                    value = Fases["2"].SPMProperties.molarfraction.GetValueOrDefault;
                    break;

                case 28:
                    //PROP_MS_28	Vapor Phase Mass Fraction
                    value = Fases["2"].SPMProperties.massfraction.GetValueOrDefault;
                    break;

                case 29:
                    //PROP_MS_29	Vapor Phase Volumetric Fraction
                    value = Fases["2"].SPMProperties.volumetric_flow.GetValueOrDefault / Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault;
                    break;

                case 30:
                    //PROP_MS_30	Liquid Phase (Mixture) Density
                    value = cv.ConverterDoSI(su.spmp_density, Fases["1"].SPMProperties.density.GetValueOrDefault);
                    break;

                case 31:
                    //PROP_MS_31	Liquid Phase (Mixture) Molar Weight
                    value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["1"].SPMProperties.molecularWeight.GetValueOrDefault);
                    break;


                case 32:
                    //PROP_MS_32	Liquid Phase (Mixture) Specific Enthalpy
                    value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["1"].SPMProperties.enthalpy.GetValueOrDefault);
                    break;


                case 33:
                    //PROP_MS_33	Liquid Phase (Mixture) Specific Entropy
                    value = cv.ConverterDoSI(su.spmp_entropy, Fases["1"].SPMProperties.entropy.GetValueOrDefault);
                    break;


                case 34:
                    //PROP_MS_34	Liquid Phase (Mixture) Molar Enthalpy
                    value = cv.ConverterDoSI(su.molar_enthalpy, Fases["1"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    break;


                case 35:
                    //PROP_MS_35	Liquid Phase (Mixture) Molar Entropy
                    value = cv.ConverterDoSI(su.molar_entropy, Fases["1"].SPMProperties.molar_entropy.GetValueOrDefault);
                    break;


                case 36:
                    //PROP_MS_36	Liquid Phase (Mixture) Thermal Conductivity
                    value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["1"].SPMProperties.thermalConductivity.GetValueOrDefault);
                    break;


                case 37:
                    //PROP_MS_37	Liquid Phase (Mixture) Kinematic Viscosity
                    value = cv.ConverterDoSI(su.spmp_cinematic_viscosity, Fases["1"].SPMProperties.kinematic_viscosity.GetValueOrDefault);
                    break;


                case 38:
                    //PROP_MS_38	Liquid Phase (Mixture) Dynamic Viscosity
                    value = cv.ConverterDoSI(su.spmp_viscosity, Fases["1"].SPMProperties.viscosity.GetValueOrDefault);
                    break;


                case 39:
                    //PROP_MS_39	Liquid Phase (Mixture) Heat Capacity (Cp)
                    value = cv.ConverterDoSI(su.spmp_heatCapacityCp, Fases["1"].SPMProperties.heatCapacityCp.GetValueOrDefault);
                    break;


                case 40:
                    //PROP_MS_40	Liquid Phase (Mixture) Heat Capacity Ratio (Cp/Cv)
                    value = Fases["1"].SPMProperties.heatCapacityCp.GetValueOrDefault / Fases["1"].SPMProperties.heatCapacityCv.GetValueOrDefault;
                    break;


                case 41:
                    //PROP_MS_41	Liquid Phase (Mixture) Mass Flow
                    value = cv.ConverterDoSI(su.spmp_massflow, Fases["1"].SPMProperties.massflow.GetValueOrDefault);
                    break;


                case 42:
                    //PROP_MS_42	Liquid Phase (Mixture) Molar Flow
                    value = cv.ConverterDoSI(su.spmp_molarflow, Fases["1"].SPMProperties.molarflow.GetValueOrDefault);
                    break;


                case 43:
                    //PROP_MS_43	Liquid Phase (Mixture) Volumetric Flow
                    value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["1"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    break;


                case 44:
                    //PROP_MS_44	Liquid Phase (Mixture) Compressibility Factor
                    value = Fases["1"].SPMProperties.compressibilityFactor.GetValueOrDefault;
                    break;


                case 45:
                    //PROP_MS_45	Liquid Phase (Mixture) Molar Fraction
                    value = Fases["1"].SPMProperties.molarfraction.GetValueOrDefault;
                    break;


                case 46:
                    //PROP_MS_46	Liquid Phase (Mixture) Mass Fraction
                    value = Fases["1"].SPMProperties.massfraction.GetValueOrDefault;
                    break;


                case 47:
                    //PROP_MS_47	Liquid Phase (Mixture) Volumetric Fraction
                    value = Fases["1"].SPMProperties.volumetric_flow.GetValueOrDefault / Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault;
                    break;


                case 48:
                    //PROP_MS_48	Liquid Phase (1) Density
                    value = cv.ConverterDoSI(su.spmp_density, Fases["3"].SPMProperties.density.GetValueOrDefault);
                    break;


                case 49:
                    //PROP_MS_49	Liquid Phase (1) Molar Weight
                    value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["3"].SPMProperties.molecularWeight.GetValueOrDefault);
                    break;


                case 50:
                    //PROP_MS_50	Liquid Phase (1) Specific Enthalpy
                    value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["3"].SPMProperties.enthalpy.GetValueOrDefault);
                    break;


                case 51:
                    //PROP_MS_51	Liquid Phase (1) Specific Entropy
                    value = cv.ConverterDoSI(su.spmp_entropy, Fases["3"].SPMProperties.entropy.GetValueOrDefault);
                    break;


                case 52:
                    //PROP_MS_52	Liquid Phase (1) Molar Enthalpy
                    value = cv.ConverterDoSI(su.molar_enthalpy, Fases["3"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    break;


                case 53:
                    //PROP_MS_53	Liquid Phase (1) Molar Entropy
                    value = cv.ConverterDoSI(su.molar_entropy, Fases["3"].SPMProperties.molar_entropy.GetValueOrDefault);
                    break;


                case 54:
                    //PROP_MS_54	Liquid Phase (1) Thermal Conductivity
                    value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["3"].SPMProperties.thermalConductivity.GetValueOrDefault);
                    break;


                case 55:
                    //PROP_MS_55	Liquid Phase (1) Kinematic Viscosity
                    value = cv.ConverterDoSI(su.spmp_cinematic_viscosity, Fases["3"].SPMProperties.kinematic_viscosity.GetValueOrDefault);
                    break;


                case 56:
                    //PROP_MS_56	Liquid Phase (1) Dynamic Viscosity
                    value = cv.ConverterDoSI(su.spmp_viscosity, Fases["3"].SPMProperties.viscosity.GetValueOrDefault);
                    break;


                case 57:
                    //PROP_MS_57	Liquid Phase (1) Heat Capacity (Cp)
                    value = cv.ConverterDoSI(su.spmp_heatCapacityCp, Fases["3"].SPMProperties.heatCapacityCp.GetValueOrDefault);
                    break;


                case 58:
                    //PROP_MS_58	Liquid Phase (1) Heat Capacity Ratio (Cp/Cv)
                    value = Fases["3"].SPMProperties.heatCapacityCp.GetValueOrDefault / Fases["3"].SPMProperties.heatCapacityCv.GetValueOrDefault;
                    break;


                case 59:
                    //PROP_MS_59	Liquid Phase (1) Mass Flow
                    value = cv.ConverterDoSI(su.spmp_massflow, Fases["3"].SPMProperties.massflow.GetValueOrDefault);
                    break;


                case 60:
                    //PROP_MS_60	Liquid Phase (1) Molar Flow
                    value = cv.ConverterDoSI(su.spmp_molarflow, Fases["3"].SPMProperties.molarflow.GetValueOrDefault);
                    break;


                case 61:
                    //PROP_MS_61	Liquid Phase (1) Volumetric Flow
                    value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["3"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    break;


                case 62:
                    //PROP_MS_62	Liquid Phase (1) Compressibility Factor
                    value = Fases["3"].SPMProperties.compressibilityFactor.GetValueOrDefault;
                    break;


                case 63:
                    //PROP_MS_63	Liquid Phase (1) Molar Fraction
                    value = Fases["3"].SPMProperties.molarfraction.GetValueOrDefault;
                    break;


                case 64:
                    //PROP_MS_64	Liquid Phase (1) Mass Fraction
                    value = Fases["3"].SPMProperties.massfraction.GetValueOrDefault;
                    break;


                case 65:
                    //PROP_MS_65	Liquid Phase (1) Volumetric Fraction
                    value = Fases["3"].SPMProperties.volumetric_flow.GetValueOrDefault / Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault;
                    break;


                case 66:
                    //PROP_MS_66	Liquid Phase (2) Density
                    value = cv.ConverterDoSI(su.spmp_density, Fases["4"].SPMProperties.density.GetValueOrDefault);
                    break;


                case 67:
                    //PROP_MS_67	Liquid Phase (2) Molar Weight
                    value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["4"].SPMProperties.molecularWeight.GetValueOrDefault);
                    break;


                case 68:
                    //PROP_MS_68	Liquid Phase (2) Specific Enthalpy
                    value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["4"].SPMProperties.enthalpy.GetValueOrDefault);
                    break;


                case 69:
                    //PROP_MS_69	Liquid Phase (2) Specific Entropy
                    value = cv.ConverterDoSI(su.spmp_entropy, Fases["4"].SPMProperties.entropy.GetValueOrDefault);
                    break;


                case 70:
                    //PROP_MS_70	Liquid Phase (2) Molar Enthalpy
                    value = cv.ConverterDoSI(su.molar_enthalpy, Fases["4"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    break;


                case 71:
                    //PROP_MS_71	Liquid Phase (2) Molar Entropy
                    value = cv.ConverterDoSI(su.molar_entropy, Fases["4"].SPMProperties.molar_entropy.GetValueOrDefault);
                    break;


                case 72:
                    //PROP_MS_72	Liquid Phase (2) Thermal Conductivity
                    value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["4"].SPMProperties.thermalConductivity.GetValueOrDefault);
                    break;


                case 73:
                    //PROP_MS_73	Liquid Phase (2) Kinematic Viscosity
                    value = cv.ConverterDoSI(su.spmp_cinematic_viscosity, Fases["4"].SPMProperties.kinematic_viscosity.GetValueOrDefault);
                    break;


                case 74:
                    //PROP_MS_74	Liquid Phase (2) Dynamic Viscosity
                    value = cv.ConverterDoSI(su.spmp_viscosity, Fases["4"].SPMProperties.viscosity.GetValueOrDefault);
                    break;


                case 75:
                    //PROP_MS_75	Liquid Phase (2) Heat Capacity (Cp)
                    value = cv.ConverterDoSI(su.spmp_heatCapacityCp, Fases["4"].SPMProperties.heatCapacityCp.GetValueOrDefault);
                    break;


                case 76:
                    //PROP_MS_76	Liquid Phase (2) Heat Capacity Ratio (Cp/Cv)
                    value = Fases["4"].SPMProperties.heatCapacityCp.GetValueOrDefault / Fases["4"].SPMProperties.heatCapacityCv.GetValueOrDefault;
                    break;


                case 77:
                    //PROP_MS_77	Liquid Phase (2) Mass Flow
                    value = cv.ConverterDoSI(su.spmp_massflow, Fases["4"].SPMProperties.massflow.GetValueOrDefault);
                    break;


                case 78:
                    //PROP_MS_78	Liquid Phase (2) Molar Flow
                    value = cv.ConverterDoSI(su.spmp_molarflow, Fases["4"].SPMProperties.molarflow.GetValueOrDefault);
                    break;


                case 79:
                    //PROP_MS_79	Liquid Phase (2) Volumetric Flow
                    value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["4"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    break;


                case 80:
                    //PROP_MS_80	Liquid Phase (2) Compressibility Factor
                    value = Fases["4"].SPMProperties.compressibilityFactor.GetValueOrDefault;
                    break;


                case 81:
                    //PROP_MS_81	Liquid Phase (2) Molar Fraction
                    value = Fases["4"].SPMProperties.molarfraction.GetValueOrDefault;
                    break;


                case 82:
                    //PROP_MS_82	Liquid Phase (2) Mass Fraction
                    value = Fases["4"].SPMProperties.massfraction.GetValueOrDefault;
                    break;


                case 83:
                    //PROP_MS_83	Liquid Phase (2) Volumetric Fraction
                    value = Fases["4"].SPMProperties.volumetric_flow.GetValueOrDefault / Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault;
                    break;


                case 84:
                    //PROP_MS_84	Aqueous Phase Density
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_density, Fases["6"].SPMProperties.density.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 85:
                    //PROP_MS_85	Aqueous Phase Molar Weight
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_molecularWeight, Fases["6"].SPMProperties.molecularWeight.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 86:
                    //PROP_MS_86	Aqueous Phase Specific Enthalpy
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_enthalpy, Fases["6"].SPMProperties.enthalpy.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 87:
                    //PROP_MS_87	Aqueous Phase Specific Entropy
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_entropy, Fases["6"].SPMProperties.entropy.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 88:
                    //PROP_MS_88	Aqueous Phase Molar Enthalpy
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.molar_enthalpy, Fases["6"].SPMProperties.molar_enthalpy.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 89:
                    //PROP_MS_89	Aqueous Phase Molar Entropy
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.molar_entropy, Fases["6"].SPMProperties.molar_entropy.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 90:
                    //PROP_MS_90	Aqueous Phase Thermal Conductivity
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_thermalConductivity, Fases["6"].SPMProperties.thermalConductivity.GetValueOrDefault)
                    else
                        value = 0;
                    break;

                case 91:
                    //PROP_MS_91	Aqueous Phase Kinematic Viscosity
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_cinematic_viscosity, Fases["6"].SPMProperties.kinematic_viscosity.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 92:
                    //PROP_MS_92	Aqueous Phase Dynamic Viscosity
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_viscosity, Fases["6"].SPMProperties.viscosity.GetValueOrDefault);
                    else
                        value = 0;
                    break;
                    
                case 93:
                    //PROP_MS_93	Aqueous Phase Heat Capacity (Cp)
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_heatCapacityCp, Fases["6"].SPMProperties.heatCapacityCp.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 94:
                    //PROP_MS_94	Aqueous Phase Heat Capacity Ratio (Cp/Cv)
                    if(Fases.ContainsKey("6"))
                        value = Fases["6"].SPMProperties.heatCapacityCp.GetValueOrDefault / Fases["6"].SPMProperties.heatCapacityCv.GetValueOrDefault;
                    else
                        value = 0;
                    break;

                case 95:
                    //PROP_MS_95	Aqueous Phase Mass Flow
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_massflow, Fases["6"].SPMProperties.massflow.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 96:
                    //PROP_MS_96	Aqueous Phase Molar Flow
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_molarflow, Fases["6"].SPMProperties.molarflow.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 97:
                    //PROP_MS_97	Aqueous Phase Volumetric Flow
                    if(Fases.ContainsKey("6"))
                        value = cv.ConverterDoSI(su.spmp_volumetricFlow, Fases["6"].SPMProperties.volumetric_flow.GetValueOrDefault);
                    else
                        value = 0;
                    break;

                case 98:
                    //PROP_MS_98	Aqueous Phase Compressibility Factor
                    if(Fases.ContainsKey("6"))
                        value = Fases["6"].SPMProperties.compressibilityFactor.GetValueOrDefault;
                    else
                        value = 0;
                    break;

                case 99:
                    //PROP_MS_99	Aqueous Phase Molar Fraction
                    if(Fases.ContainsKey("6"))
                        value = Fases["6"].SPMProperties.molarfraction.GetValueOrDefault;
                    else
                        value = 0;
                    break;

                case 100:
                    //PROP_MS_100	Aqueous Phase Mass Fraction
                    if(Fases.ContainsKey("6"))
                        value = Fases["6"].SPMProperties.massfraction.GetValueOrDefault;
                    else
                        value = 0;
                    break;

                case 101:
                    //PROP_MS_101	Aqueous Phase Volumetric Fraction
                    if(Fases.ContainsKey("6"))
                        value = Fases["6"].SPMProperties.volumetric_flow.GetValueOrDefault / Fases["0"].SPMProperties.volumetric_flow.GetValueOrDefault;
                    else
                        value = 0;
                    break;

                case 103:
                case 111:
                case 112:
                case 113:
                case 114:
                case 115:
                    if( Fases["0"].Componentes.ContainsKey(sname))
                    {
                        if( propidx == 103 )
                            value = Fases["0"].Componentes(sname).FracaoMassica.GetValueOrDefault;
                        else if(propidx == 111) 
                            value = Fases["2"].Componentes(sname).FracaoMassica.GetValueOrDefault;
                        else if (propidx == 112) 
                            value = Fases["1"].Componentes(sname).FracaoMassica.GetValueOrDefault;
                        else if(propidx == 113) 
                            value = Fases["3"].Componentes(sname).FracaoMassica.GetValueOrDefault;
                        else if (propidx == 114) 
                            value = Fases["4"].Componentes(sname).FracaoMassica.GetValueOrDefault;
                        else if (propidx == 115) 
                            value = Me.Fases(5).Componentes(sname).FracaoMassica.GetValueOrDefault;
                    }
                    else
                        value = 0;
                    break;
                case 102:
                case 106:
                case 107:
                case 108:
                case 109:
                case 110:
                    if( Fases["0"].Componentes.ContainsKey(sname))
                    {
                        if(propidx == 102)
                            value = Fases["0"].Componentes(sname).FracaoMolar.GetValueOrDefault;
                        else if( propidx = 106)
                            value = Fases["2"].Componentes(sname).FracaoMolar.GetValueOrDefault;
                        else if(propidx == 107)
                            value = Fases["1"].Componentes(sname).FracaoMolar.GetValueOrDefault;
                        else if(propidx == 108)
                            value = Fases["3"].Componentes(sname).FracaoMolar.GetValueOrDefault;
                        else if( propidx == 109)
                            value = Fases["4"].Componentes(sname).FracaoMolar.GetValueOrDefault;
                        else if (propidx == 110 )
                            value = Me.Fases(5).Componentes(sname).FracaoMolar.GetValueOrDefault;
                    }
                    else
                        value = 0;
                    break;

                case 104:
                case 116:
                case 117:
                case 118:
                case 119:
                case 120:

                    if (Fases["0"].Componentes.ContainsKey(sname))
                    {    
                        if( propidx == 104)
                            value = Fases["0"].Componentes(sname).MolarFlow.GetValueOrDefault;
                        else if (propidx == 116)
                            value = Fases["2"].Componentes(sname).MolarFlow.GetValueOrDefault;
                        else if(propidx == 117)
                            value = Fases["1"].Componentes(sname).MolarFlow.GetValueOrDefault;
                        else if(propidx = 118)
                            value = Fases["3"].Componentes(sname).MolarFlow.GetValueOrDefault;
                        else if(propidx == 119)
                            value = Fases["4"].Componentes(sname).MolarFlow.GetValueOrDefault;
                        else if (propidx == 120) 
                            value = Me.Fases(5).Componentes(sname).MolarFlow.GetValueOrDefault;
                    }
                    else
                        value = 0;
                    break;

                case 105:
                case 121:
                case 122:
                case 123:
                case 124:
                case 125:
                    if( Fases["0"].Componentes.ContainsKey(sname))
                    {
                        if(propidx == 105)
                            value = Fases["0"].Componentes(sname).MassFlow.GetValueOrDefault;
                        else if(propidx == 121)
                            value = Fases["2"].Componentes(sname).MassFlow.GetValueOrDefault;
                        else if(propidx == 122)
                            value = Fases["1"].Componentes(sname).MassFlow.GetValueOrDefault;
                        else if(propidx == 123)
                            value = Fases["3"].Componentes(sname).MassFlow.GetValueOrDefault;
                        else if(propidx == 124)
                            value = Fases["4"].Componentes(sname).MassFlow.GetValueOrDefault;
                        else if(propidx == 125)
                            value = Me.Fases(5).Componentes(sname).MassFlow.GetValueOrDefault;
                    }
                    else
                        value = 0;
                    break;
                case 126:
                    value = cv.ConverterDoSI(su.spmp_pressure, Fases["0"].SPMProperties.bubblePressure.GetValueOrDefault);
                    break;
                case 127:
                    value = cv.ConverterDoSI(su.spmp_pressure, Fases["0"].SPMProperties.dewPressure.GetValueOrDefault);
                    break;
                case 128:
                    value = cv.ConverterDoSI(su.spmp_temperature, Fases["0"].SPMProperties.bubbleTemperature.GetValueOrDefault);
                    break;
                case 129:
                    value = cv.ConverterDoSI(su.spmp_temperature, Fases["0"].SPMProperties.dewTemperature.GetValueOrDefault);
                    break;
                case 130:
                    if( Fases["1"].SPMProperties.molarfraction.GetValueOrDefault = 1.0# )
                        value = "Liquid Only";
                    else if (Fases["2"].SPMProperties.molarfraction.GetValueOrDefault = 1.0#)
                        value = "Vapor Only";
                    else
                        value = "Mixed";
            }

            return value;           
        }

        public override string[] GetProperties(PropertyType proptype )
        {
               return new string[]{};
        }

        public override object SetPropertyValue(string prop, object propval , Unidades su  = null) 
        {
            /*
            If su Is Nothing Then su = New DTL.SistemasDeUnidades.UnidadesSI
            Dim cv As New DTL.SistemasDeUnidades.Conversor
            Dim propidx As Integer = CInt(prop.Split(",")(0).Split("_")(2))
            Dim sname As String = ""
            If prop.Split(",").Length = 2 Then
                sname = prop.Split(",")(1)
            End If

            Me.PropertyPackage.CurrentMaterialStream = Me

            Select case propidx
                case 0
                    //PROP_MS_0 Temperature
                    Fases["0"].SPMProperties.temperature = cv.ConverterParaSI(su.spmp_temperature, propval)
                case 1
                    //PROP_MS_1 Pressure
                    Fases["0"].SPMProperties.pressure = cv.ConverterParaSI(su.spmp_pressure, propval)
                case 2
                    //PROP_MS_2	Mass Flow
                    Fases["0"].SPMProperties.massflow = cv.ConverterParaSI(su.spmp_massflow, propval)
                    Me.PropertyPackage.DW_CalcVazaoMolar()
                    Me.PropertyPackage.DW_CalcVazaoVolumetrica()
                case 3
                    //PROP_MS_3	Molar Flow
                    Fases["0"].SPMProperties.molarflow = cv.ConverterParaSI(su.spmp_molarflow, propval)
                    Me.PropertyPackage.DW_CalcVazaoMassica()
                    Me.PropertyPackage.DW_CalcVazaoVolumetrica()
                case 4
                    //PROP_MS_4	Volumetric Flow
                    Fases["0"].SPMProperties.volumetric_flow = cv.ConverterParaSI(su.spmp_volumetricFlow, propval)
                    Fases["0"].SPMProperties.massflow = Fases["0"].SPMProperties.volumetric_flow * Fases["0"].SPMProperties.density.GetValueOrDefault
                    Me.PropertyPackage.DW_CalcVazaoMolar()
                case 102
                    If Fases["0"].Componentes.ContainsKey(sname) Then
                        Fases["0"].Componentes(sname).FracaoMolar = propval
                        Dim sumfm As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            sumfm += comp.FracaoMolar
                        Next
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMolar /= sumfm
                        Next
                        Dim mtotal As Double = 0
                        Me.PropertyPackage.DW_CalcCompMolarFlow(0)
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            mtotal += comp.FracaoMolar.GetValueOrDefault * comp.ConstantProperties.Molar_Weight
                        Next
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMassica = comp.FracaoMolar.GetValueOrDefault * comp.ConstantProperties.Molar_Weight / mtotal
                        Next
                        Me.PropertyPackage.DW_CalcCompMassFlow(0)
                    End If
                case 103
                    If Fases["0"].Componentes.ContainsKey(sname) Then
                        Fases["0"].Componentes(sname).FracaoMassica = propval
                        Dim sumfm As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            sumfm += comp.FracaoMassica
                        Next
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMassica /= sumfm
                        Next
                        Dim mtotal As Double = 0
                        Me.PropertyPackage.DW_CalcCompMassFlow(0)
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            mtotal += comp.FracaoMassica.GetValueOrDefault / comp.ConstantProperties.Molar_Weight
                        Next
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMolar = comp.FracaoMassica.GetValueOrDefault / comp.ConstantProperties.Molar_Weight / mtotal
                        Next
                        Me.PropertyPackage.DW_CalcCompMolarFlow(0)
                    End If
                case 104
                    If Fases["0"].Componentes.ContainsKey(sname) Then
                        Fases["0"].Componentes(sname).MolarFlow = cv.ConverterParaSI(su.spmp_molarflow, propval)
                        Fases["0"].Componentes(sname).MassFlow = cv.ConverterParaSI(su.spmp_molarflow, propval) / 1000 * Fases["0"].Componentes(sname).ConstantProperties.Molar_Weight
                        Dim summ As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            summ += comp.MolarFlow
                        Next
                        Fases["0"].SPMProperties.molarflow = summ
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMolar = comp.MolarFlow / summ
                        Next
                        Dim mtotal As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            mtotal += comp.FracaoMolar.GetValueOrDefault * comp.ConstantProperties.Molar_Weight
                        Next
                        Fases["0"].SPMProperties.massflow = mtotal * summ / 1000
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMassica = comp.MolarFlow.GetValueOrDefault * Fases["0"].SPMProperties.massflow.GetValueOrDefault
                        Next
                    End If
                case 105
                    If Fases["0"].Componentes.ContainsKey(sname) Then
                        Fases["0"].Componentes(sname).MassFlow = cv.ConverterParaSI(su.spmp_massflow, propval)
                        Fases["0"].Componentes(sname).MolarFlow = cv.ConverterParaSI(su.spmp_massflow, propval) / Fases["0"].Componentes(sname).ConstantProperties.Molar_Weight * 1000
                        Dim mtotal As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            mtotal += comp.MassFlow
                        Next
                        Fases["0"].SPMProperties.massflow = mtotal
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMassica = comp.MassFlow / mtotal
                        Next
                        Dim summ As Double = 0
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            summ += comp.FracaoMassica.GetValueOrDefault / comp.ConstantProperties.Molar_Weight / 1000
                        Next
                        Fases["0"].SPMProperties.molarflow = mtotal / summ
                        For Each comp As Substancia In Fases["0"].Componentes.Values
                            comp.FracaoMolar = comp.MolarFlow.GetValueOrDefault * Fases["0"].SPMProperties.molarflow.GetValueOrDefault
                        Next
                    End If
            End Select
            Return 1
            */
        }

        public override object GetPropertyUnit(string prop , Unidades = null)
        {
            /*
            If su Is Nothing Then su = New DTL.SistemasDeUnidades.UnidadesSI
            Dim value As String = ""
            Dim propidx As Integer = CInt(prop.Split(",")(0).Split("_")(2))

            Select case propidx

                case 0
                    //PROP_MS_0 Temperature
                    value = su.spmp_temperature
                case 1
                    //PROP_MS_1 Pressure
                    value = su.spmp_pressure
                case 2
                    //PROP_MS_2	Mass Flow
                    value = su.spmp_massflow
                case 3
                    //PROP_MS_3	Molar Flow
                    value = su.spmp_molarflow
                case 4
                    //PROP_MS_4	Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 5
                    //PROP_MS_5	Mixture Density
                    value = su.spmp_density
                case 6
                    //PROP_MS_6	Mixture Molar Weight
                    value = su.spmp_molecularWeight
                case 7
                    //PROP_MS_7	Mixture Specific Enthalpy
                    value = su.spmp_enthalpy
                case 8
                    //PROP_MS_8	Mixture Specific Entropy
                    value = su.spmp_entropy
                case 9
                    //PROP_MS_9	Mixture Molar Enthalpy
                    value = su.molar_enthalpy
                case 10
                    //PROP_MS_10	Mixture Molar Entropy
                    value = su.molar_entropy
                case 11
                    //PROP_MS_11	Mixture Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 12
                    //PROP_MS_12	Vapor Phase Density
                    value = su.spmp_density
                case 13
                    //PROP_MS_13	Vapor Phase Molar Weight
                    value = su.spmp_molecularWeight
                case 14
                    //PROP_MS_14	Vapor Phase Specific Enthalpy
                    value = su.spmp_enthalpy
                case 15
                    //PROP_MS_15	Vapor Phase Specific Entropy
                    value = su.spmp_entropy
                case 16
                    //PROP_MS_16	Vapor Phase Molar Enthalpy
                    value = su.molar_enthalpy
                case 17
                    //PROP_MS_17	Vapor Phase Molar Entropy
                    value = su.molar_entropy
                case 18
                    //PROP_MS_18	Vapor Phase Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 19
                    //PROP_MS_19	Vapor Phase Kinematic Viscosity
                    value = su.spmp_cinematic_viscosity
                case 20
                    //PROP_MS_20	Vapor Phase Dynamic Viscosity
                    value = su.spmp_viscosity
                case 21
                    //PROP_MS_21	Vapor Phase Heat Capacity (Cp)
                    value = su.spmp_heatCapacityCp
                case 22
                    //PROP_MS_22	Vapor Phase Heat Capacity Ratio (Cp/Cv)
                    value = ""
                case 23
                    //PROP_MS_23	Vapor Phase Mass Flow
                    value = su.spmp_massflow
                case 24
                    //PROP_MS_24	Vapor Phase Molar Flow
                    value = su.spmp_molarflow
                case 25
                    //PROP_MS_25	Vapor Phase Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 26
                    //PROP_MS_26	Vapor Phase Compressibility Factor
                    value = ""
                case 27
                    //PROP_MS_27	Vapor Phase Molar Fraction
                    value = ""
                case 28
                    //PROP_MS_28	Vapor Phase Mass Fraction
                    value = ""
                case 29
                    //PROP_MS_29	Vapor Phase Volumetric Fraction
                    value = ""
                case 30
                    //PROP_MS_30	Liquid Phase (Mixture) Density
                    value = su.spmp_density
                case 31
                    //PROP_MS_31	Liquid Phase (Mixture) Molar Weight
                    value = su.spmp_molecularWeight
                case 32
                    //PROP_MS_32	Liquid Phase (Mixture) Specific Enthalpy
                    value = su.spmp_enthalpy
                case 33
                    //PROP_MS_33	Liquid Phase (Mixture) Specific Entropy
                    value = su.spmp_entropy
                case 34
                    //PROP_MS_34	Liquid Phase (Mixture) Molar Enthalpy
                    value = su.molar_enthalpy
                case 35
                    //PROP_MS_35	Liquid Phase (Mixture) Molar Entropy
                    value = su.molar_entropy
                case 36
                    //PROP_MS_36	Liquid Phase (Mixture) Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 37
                    //PROP_MS_37	Liquid Phase (Mixture) Kinematic Viscosity
                    value = su.spmp_cinematic_viscosity
                case 38
                    //PROP_MS_38	Liquid Phase (Mixture) Dynamic Viscosity
                    value = su.spmp_viscosity
                case 39
                    //PROP_MS_39	Liquid Phase (Mixture) Heat Capacity (Cp)
                    value = su.spmp_heatCapacityCp
                case 40
                    //PROP_MS_40	Liquid Phase (Mixture) Heat Capacity Ratio (Cp/Cv)
                    value = ""
                case 41
                    //PROP_MS_41	Liquid Phase (Mixture) Mass Flow
                    value = su.spmp_massflow
                case 42
                    //PROP_MS_42	Liquid Phase (Mixture) Molar Flow
                    value = su.spmp_molarflow
                case 43
                    //PROP_MS_43	Liquid Phase (Mixture) Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 44
                    //PROP_MS_44	Liquid Phase (Mixture) Compressibility Factor
                    value = ""
                case 45
                    //PROP_MS_45	Liquid Phase (Mixture) Molar Fraction
                    value = ""
                case 46
                    //PROP_MS_46	Liquid Phase (Mixture) Mass Fraction
                    value = ""
                case 47
                    //PROP_MS_47	Liquid Phase (Mixture) Volumetric Fraction
                    value = ""
                case 48
                    //PROP_MS_48	Liquid Phase (1) Density
                    value = su.spmp_density
                case 49
                    //PROP_MS_49	Liquid Phase (1) Molar Weight
                    value = su.spmp_molecularWeight
                case 50
                    //PROP_MS_50	Liquid Phase (1) Specific Enthalpy
                    value = su.spmp_enthalpy
                case 51
                    //PROP_MS_51	Liquid Phase (1) Specific Entropy
                    value = su.spmp_entropy
                case 52
                    //PROP_MS_52	Liquid Phase (1) Molar Enthalpy
                    value = su.molar_enthalpy
                case 53
                    //PROP_MS_53	Liquid Phase (1) Molar Entropy
                    value = su.molar_entropy
                case 54
                    //PROP_MS_54	Liquid Phase (1) Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 55
                    //PROP_MS_55	Liquid Phase (1) Kinematic Viscosity
                    value = su.spmp_cinematic_viscosity
                case 56
                    //PROP_MS_56	Liquid Phase (1) Dynamic Viscosity
                    value = su.spmp_viscosity
                case 57
                    //PROP_MS_57	Liquid Phase (1) Heat Capacity (Cp)
                    value = su.spmp_heatCapacityCp
                case 58
                    //PROP_MS_58	Liquid Phase (1) Heat Capacity Ratio (Cp/Cv)
                    value = ""
                case 59
                    //PROP_MS_59	Liquid Phase (1) Mass Flow
                    value = su.spmp_massflow
                case 60
                    //PROP_MS_60	Liquid Phase (1) Molar Flow
                    value = su.spmp_molarflow
                case 61
                    //PROP_MS_61	Liquid Phase (1) Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 62
                    //PROP_MS_62	Liquid Phase (1) Compressibility Factor
                    value = ""
                case 63
                    //PROP_MS_63	Liquid Phase (1) Molar Fraction
                    value = ""
                case 64
                    //PROP_MS_64	Liquid Phase (1) Mass Fraction
                    value = ""
                case 65
                    //PROP_MS_65	Liquid Phase (1) Volumetric Fraction
                    value = ""
                case 66
                    //PROP_MS_66	Liquid Phase (2) Density
                    value = su.spmp_density
                case 67
                    //PROP_MS_67	Liquid Phase (2) Molar Weight
                    value = su.spmp_molecularWeight
                case 68
                    //PROP_MS_68	Liquid Phase (2) Specific Enthalpy
                    value = su.spmp_enthalpy
                case 69
                    //PROP_MS_69	Liquid Phase (2) Specific Entropy
                    value = su.spmp_entropy
                case 70
                    //PROP_MS_70	Liquid Phase (2) Molar Enthalpy
                    value = su.molar_enthalpy
                case 71
                    //PROP_MS_71	Liquid Phase (2) Molar Entropy
                    value = su.molar_entropy
                case 72
                    //PROP_MS_72	Liquid Phase (2) Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 73
                    //PROP_MS_73	Liquid Phase (2) Kinematic Viscosity
                    value = su.spmp_cinematic_viscosity
                case 74
                    //PROP_MS_74	Liquid Phase (2) Dynamic Viscosity
                    value = su.spmp_viscosity
                case 75
                    //PROP_MS_75	Liquid Phase (2) Heat Capacity (Cp)
                    value = su.spmp_heatCapacityCp
                case 76
                    //PROP_MS_76	Liquid Phase (2) Heat Capacity Ratio (Cp/Cv)
                    value = ""
                case 77
                    //PROP_MS_77	Liquid Phase (2) Mass Flow
                    value = su.spmp_massflow
                case 78
                    //PROP_MS_78	Liquid Phase (2) Molar Flow
                    value = su.spmp_molarflow
                case 79
                    //PROP_MS_79	Liquid Phase (2) Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 80
                    //PROP_MS_80	Liquid Phase (2) Compressibility Factor
                    value = ""
                case 81
                    //PROP_MS_81	Liquid Phase (2) Molar Fraction
                    value = ""
                case 82
                    //PROP_MS_82	Liquid Phase (2) Mass Fraction
                    value = ""
                case 83
                    //PROP_MS_83	Liquid Phase (2) Volumetric Fraction
                    value = ""
                case 84
                    //PROP_MS_84	Aqueous Phase Density
                    value = su.spmp_density
                case 85
                    //PROP_MS_85	Aqueous Phase Molar Weight
                    value = su.spmp_molecularWeight
                case 86
                    //PROP_MS_86	Aqueous Phase Specific Enthalpy
                    value = su.spmp_enthalpy
                case 87
                    //PROP_MS_87	Aqueous Phase Specific Entropy
                    value = su.spmp_entropy
                case 88
                    //PROP_MS_88	Aqueous Phase Molar Enthalpy
                    value = su.molar_enthalpy
                case 89
                    //PROP_MS_89	Aqueous Phase Molar Entropy
                    value = su.molar_entropy
                case 90
                    //PROP_MS_90	Aqueous Phase Thermal Conductivity
                    value = su.spmp_thermalConductivity
                case 91
                    //PROP_MS_91	Aqueous Phase Kinematic Viscosity
                    value = su.spmp_cinematic_viscosity
                case 92
                    //PROP_MS_92	Aqueous Phase Dynamic Viscosity
                    value = su.spmp_viscosity
                case 93
                    //PROP_MS_93	Aqueous Phase Heat Capacity (Cp)
                    value = su.spmp_heatCapacityCp
                case 94
                    //PROP_MS_94	Aqueous Phase Heat Capacity Ratio (Cp/Cv)
                    value = ""
                case 95
                    //PROP_MS_95	Aqueous Phase Mass Flow
                    value = su.spmp_massflow
                case 96
                    //PROP_MS_96	Aqueous Phase Molar Flow
                    value = su.spmp_molarflow
                case 97
                    //PROP_MS_97	Aqueous Phase Volumetric Flow
                    value = su.spmp_volumetricFlow
                case 98
                    //PROP_MS_98	Aqueous Phase Compressibility Factor
                    value = ""
                case 99
                    //PROP_MS_99	Aqueous Phase Molar Fraction
                    value = ""
                case 100
                    //PROP_MS_100	Aqueous Phase Mass Fraction
                    value = ""
                case 101
                    //PROP_MS_101	Aqueous Phase Volumetric Fraction
                    value = ""
                case 102, 103, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115
                    value = ""
                case 104, 116, 117, 118, 119, 120
                    value = su.spmp_molarflow
                case 105, 121, 122, 123, 124, 125
                    value = su.spmp_massflow
                case 126, 127
                    value = su.spmp_pressure
                case 128, 129
                    value = su.spmp_temperature
                case 130
                    value = ""
            End Select

            Return value
            */ 
       }

    }
}